<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: SCB          (Serial Communication Block)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__scb.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">SCB (Serial Communication Block)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>The Serial Communications Block (SCB) supports three serial communication protocols: Serial Peripheral Interface (SPI), Universal Asynchronous Receiver Transmitter (UART), and Inter Integrated Circuit (I2C or IIC). </p>
<p>Only one of the protocols is supported by an SCB at any given time.</p>
<p>The functions and other declarations used in this driver are in cy_scb_spi.h, cy_scb_uart.h, cy_scb_ezi2c.h, cy_scb_i2c.h respectively. Include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<h1><a class="anchor" id="group_scb_more_information"></a>
More Information</h1>
<p>For more information on the SCB peripheral, refer to the technical reference manual (TRM).</p>
<h1><a class="anchor" id="group_scb_common_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td>3.30 </td><td>Updated internal macro to enable UART Half Duplex APIs only on supported devices. </td><td>Code enhancement.  </td></tr>
<tr>
<td rowspan="2">3.20 </td><td>Added APIs <a class="el" href="group__group__scb__uart__general__functions.html#ga67842f041cc8abbda979ee2bac1923c1">Cy_SCB_UART_EnableSingleWireHalfDuplex</a>, <a class="el" href="group__group__scb__uart__general__functions.html#ga3e6e60fdc4bd677787d72f2c079f46be">Cy_SCB_UART_DisableSingleWireHalfDuplex</a>.<ul>
<li>Updated struct <a class="el" href="structcy__stc__scb__uart__config__t.html">cy_stc_scb_uart_config_t</a>.  </li>
</ul>
</td><td>UART half duplex mode implementation. Bug fixes.  </td></tr>
<tr>
<td>Added API <a class="el" href="group__group__scb__spi__high__level__functions.html#ga27711123413735711f1b1c708ad7ce26">Cy_SCB_SPI_Transfer_Buffer</a> and new macros.<ul>
<li>Updated struct <a class="el" href="structcy__stc__scb__spi__context__t.html">cy_stc_scb_spi_context_t</a>. </li>
</ul>
</td><td>Added support for SPI transfer with different length and bug fixes for buffer transfer with different sizes.  </td></tr>
<tr>
<td>3.10.1 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td>3.10 </td><td>Fixed MISRA 2012 violations. </td><td>MISRA 2012 compliance.  </td></tr>
<tr>
<td rowspan="2">3.0 </td><td>Updated <a class="el" href="group__group__scb__spi__general__functions.html#gabe68169c810119b93e1164127663033c">Cy_SCB_SPI_Init</a> and other internal data handling functions to handle wide range of data widths. </td><td>Defect fixing.  </td></tr>
<tr>
<td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td rowspan="2">2.90 </td><td>A new API, <a class="el" href="group__group__scb__ezi2c__general__functions.html#ga3f5a46deab427f46285992e1cbf8d361">Cy_SCB_SetEzI2CMode</a>, has been added to help set the hardware EZ mode for the I2C protocol. </td><td>The HW EZ Mode for the I2C protocol can be enabled or disabled.  </td></tr>
<tr>
<td>Newly added APIs <a class="el" href="group__group__scb__i2c__general__functions.html#ga22f1ebfff05be21316da5126807e78b6">Cy_SCB_I2C_SetStretchThreshold</a> to set the stretch threshold value, <a class="el" href="group__group__scb__i2c__general__functions.html#gaa2d07f085f4ffd0682a7047f77c3f450">Cy_SCB_I2C_GetStretchCount</a> to get the stretch count, <a class="el" href="group__group__scb__i2c__general__functions.html#gade527ee35b573ec84b5142631a3e4d59">Cy_SCB_I2C_IsStretchDetected</a> to detect if I2C SCL is stretched, <a class="el" href="group__group__scb__i2c__general__functions.html#gad69a133c6bcb6438a186bce6f785d7ac">Cy_SCB_I2C_IsSyncDetected</a> to check if synchronization is detected on I2C SCL. <a class="el" href="group__group__scb__i2c__general__functions.html#ga0dda1a9c2ce73e6ec0bf46229611c303">Cy_SCB_I2C_IsStretching</a> to check if DUT is stretching the I2C SCL. </td><td>New device support.  </td></tr>
<tr>
<td>2.80 </td><td>Updated the behaviour of <a class="el" href="group__group__scb__uart__low__level__functions.html#gaeb5f34c160e5ddccb9bde86b6400e6ca">Cy_SCB_UART_SetEnableMsbFirst</a> and <a class="el" href="group__group__scb__uart__low__level__functions.html#gaaf655f8c8143c4f0f98c3dadf34091ff">Cy_SCB_UART_GetEnableMsbFirst</a> functions. Now the value of enableMsbFirst is being set and fetched correctly. </td><td>Defect fixing.  </td></tr>
<tr>
<td rowspan="2">2.70 </td><td>Newly added API's for runtime parameter set/get functionality which include <a class="el" href="group__group__scb__uart__low__level__functions.html#ga953a2e5de2843bec5149214fbbf8d866">Cy_SCB_UART_SetOverSample</a> to set oversample bits of UART, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga6198ae1a865423d022a52b60f0589640">Cy_SCB_UART_GetOverSample</a> to add return value of oversample, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga0e78bbf1f988c83e4b854913165c522a">Cy_SCB_UART_GetDataWidth</a> to get data width, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga0168b95a1eef359b3bd9d656dc58eada">Cy_SCB_UART_SetDataWidth</a> to set data width, <a class="el" href="group__group__scb__uart__low__level__functions.html#gaefd348e5429248635e3513d38b093ca2">Cy_SCB_UART_GetParity</a> to get parity, <a class="el" href="group__group__scb__uart__low__level__functions.html#gadba2318f8135a722f861c61e299cf955">Cy_SCB_UART_SetParity</a> to set parity, <a class="el" href="group__group__scb__uart__low__level__functions.html#gaafd878e3e54925cf1d10ca38f2a89e11">Cy_SCB_UART_GetStopBits</a> to get stop bits, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga1a74d57246b3f64b61514d352479fbe4">Cy_SCB_UART_SetStopBits</a> to set stop bits, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga479378d045a9d97d279ff24667661995">Cy_SCB_UART_GetDropOnParityError</a> to get drop on parity error, <a class="el" href="group__group__scb__uart__low__level__functions.html#ga7c6796283644936b5501085bdb5981b9">Cy_SCB_UART_SetDropOnParityError</a> to set drop on parity error, <a class="el" href="group__group__scb__uart__low__level__functions.html#gaaf655f8c8143c4f0f98c3dadf34091ff">Cy_SCB_UART_GetEnableMsbFirst</a> to get enable MSB first and <a class="el" href="group__group__scb__uart__low__level__functions.html#gaeb5f34c160e5ddccb9bde86b6400e6ca">Cy_SCB_UART_SetEnableMsbFirst</a> to set enable MSB first. </td><td>Runtime Parameter update.  </td></tr>
<tr>
<td>Newly added API's which include <a class="el" href="group__group__scb__common__functions.html#gaef77f8b5b4b94d3413a05517165591a2">Cy_SCB_Get_RxDataWidth</a> to return the RX data width, <a class="el" href="group__group__scb__common__functions.html#ga60f36e44a9aed61db905e17ab7c6b495">Cy_SCB_Get_TxDataWidth</a> to return the TX data width, <a class="el" href="group__group__scb__common__functions.html#ga9fe5bef3c2e514b7a34d195ad678926d">Cy_SCB_SetMemWidth</a> to set the RX and TX FIFOs byte mode/halfword/word mode. Updated Structures <a class="el" href="structcy__stc__scb__uart__config__t.html">cy_stc_scb_uart_config_t</a>, <a class="el" href="group__group__scb__spi__enums.html#gaf244ff9c484db24f4935bfec1a397383">cy_en_scb_spi_parity_t</a>, <a class="el" href="structcy__stc__scb__spi__config__t.html">cy_stc_scb_spi_config_t</a>. </td><td>New device support.  </td></tr>
<tr>
<td rowspan="2">2.60 </td><td>Fixed the <a class="el" href="group__group__scb__uart__high__level__functions.html#gaa497f01cc0fdc16bc050869160138954">Cy_SCB_UART_GetNumInRingBuffer</a> function to return correct number of the elements in ring buffer. </td><td><a class="el" href="group__group__scb__uart__high__level__functions.html#gaa497f01cc0fdc16bc050869160138954">Cy_SCB_UART_GetNumInRingBuffer</a> function works incorrectly, when write pointer of the ring buffer is behind the read pointer.  </td></tr>
<tr>
<td>Fixed/Documented MISRA 2012 violations. </td><td>MISRA 2012 compliance.  </td></tr>
<tr>
<td>2.50 </td><td>Fixed the <a class="el" href="group__group__scb__spi__general__functions.html#ga1473d59d9fe1fbe9a981a2af34c6904d">Cy_SCB_SPI_SetActiveSlaveSelectPolarity</a> function to properly configure the polarity of the slave select line. </td><td><a class="el" href="group__group__scb__spi__general__functions.html#ga1473d59d9fe1fbe9a981a2af34c6904d">Cy_SCB_SPI_SetActiveSlaveSelectPolarity</a> function works incorrectly.  </td></tr>
<tr>
<td>2.40.2 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td rowspan="2">2.40 </td><td>Update level selection logic of RX FIFO trigger in the <a class="el" href="group__group__scb__uart__high__level__functions.html#gace7421c664f582ab4ad4bade0683f209" title="This function starts a UART receive operation. ">Cy_SCB_UART_Receive()</a>. </td><td>Fix possible stuck if the RTS level is less than the RX FIFO level.  </td></tr>
<tr>
<td>Exclude self-test assertion macros under release build profile. </td><td>Avoid dependency on CY_ASSERT macro implementation.  </td></tr>
<tr>
<td>2.30.1 </td><td>Added header guards CY_IP_MXSCB. </td><td>To enable the PDL compilation with wounded out IP blocks.  </td></tr>
<tr>
<td rowspan="5">2.30 </td><td>Fixed MISRA violation. </td><td>MISRA compliance.  </td></tr>
<tr>
<td>Changed values CY_SCB_SPI_CPHA0_CPOL1 and CY_SCB_SPI_CPHA1_CPOL0 in enum <a class="el" href="group__group__scb__spi__enums.html#gab34eae51343cebfec7c447a573cdf0ba">cy_en_scb_spi_sclk_mode_t</a>. </td><td>The incorrect values in <a class="el" href="group__group__scb__spi__enums.html#gab34eae51343cebfec7c447a573cdf0ba">cy_en_scb_spi_sclk_mode_t</a> caused incorrect initialization of the combination of phases and polarity: "CHPA = 0, CPOL = 1" and "CHPA = 1, CPOL = 0".   </td></tr>
<tr>
<td>Added new CY_SCB_UART_RECEIVE_NOT_EMTPY and CY_SCB_UART_TRANSMIT_EMTPY callback events <a class="el" href="group__group__scb__uart__macros__callback__events.html">UART Callback Events</a>. </td><td>Extended the driver callback events to support the MBED-OS.  </td></tr>
<tr>
<td>Merged SCB changelogs for each mode into one changelog. </td><td>Changelog optimization.  </td></tr>
<tr>
<td>Merged SCB MISRA-C Compliance sections for each mode into one section. </td><td>To optimize the SCB MISRA-C Compliance sections.  </td></tr>
<tr>
<td>2.20.1 </td><td>Documentation of the MISRA rule violation. </td><td>MISRA compliance.  </td></tr>
<tr>
<td rowspan="4">2.20 </td><td>Flattened the organization of the driver source code into the single source directory and the single include directory.  </td><td>Driver library directory-structure simplification.  </td></tr>
<tr>
<td>Added register access layer. Use register access macros instead of direct register access using dereferenced pointers. </td><td>Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.  </td></tr>
<tr>
<td>Added the enableDigitalFilter, highPhaseDutyCycle and lowPhaseDutyCycle fields to the <a class="el" href="structcy__stc__scb__i2c__config__t.html">cy_stc_scb_i2c_config_t</a> configuration structure.  </td><td>Added the I2C master data rate configuration using the configuration structure.   </td></tr>
<tr>
<td>Fixed the <a class="el" href="group__group__scb__i2c__general__functions.html#gae9d71372b84c9c799b55283fc475f223">Cy_SCB_I2C_SetDataRate</a> function to properly configure data rates greater than 400 kbps in Master and Master-Slave modes. <br />
 Added verification that clk_scb is within the valid range for the desired data rate.  </td><td>The analog filter was enabled for all data rates in Master and Master-Slave modes. This prevents reaching the maximum supported data rate of 1000 kbps which requires a digital filter.   </td></tr>
<tr>
<td rowspan="4">2.10 </td><td>Fixed the ReStart condition generation sequence for a write transaction in the <a class="el" href="group__group__scb__i2c__master__high__level__functions.html#ga91f7a32d2a20cf3deebe01cef8d9d000">Cy_SCB_I2C_MasterWrite</a> function. </td><td>The driver can notify about a zero length write transaction completion before the address byte is sent if the <a class="el" href="group__group__scb__i2c__master__high__level__functions.html#ga91f7a32d2a20cf3deebe01cef8d9d000">Cy_SCB_I2C_MasterWrite</a> function execution was interrupted between setting the restart generation command and writing the address byte into the TX FIFO.  </td></tr>
<tr>
<td>Added the slave- and master-specific interrupt functions: <a class="el" href="group__group__scb__i2c__interrupt__functions.html#ga87512a96b0ae32bb624a5a960d64d23f">Cy_SCB_I2C_SlaveInterrupt</a> and <a class="el" href="group__group__scb__i2c__interrupt__functions.html#ga3133d46624010df1c57a0800797aab01">Cy_SCB_I2C_MasterInterrupt</a>.  </td><td>Improved the interrupt configuration options for the I2C slave and master mode configurations.  </td></tr>
<tr>
<td>Updated the Start condition generation sequence in the <a class="el" href="group__group__scb__i2c__master__high__level__functions.html#ga91f7a32d2a20cf3deebe01cef8d9d000">Cy_SCB_I2C_MasterWrite</a> and <a class="el" href="group__group__scb__i2c__master__high__level__functions.html#ga83185adeefa83640ac09852c9d6cf426">Cy_SCB_I2C_MasterRead</a>. </td><td></td></tr>
<tr>
<td>Updated the ReStart condition generation sequence for a write transaction in the <a class="el" href="group__group__scb__i2c__master__low__level__functions.html#ga2177b4fb74cf33e57e6fa59d04bdfa7a">Cy_SCB_I2C_MasterSendReStart</a> function. </td><td></td></tr>
<tr>
<td rowspan="9">2.0 </td><td>Added parameters validation for public API. </td><td></td></tr>
<tr>
<td>Fixed functions which return interrupt status to return only defined set of interrupt statuses. </td><td></td></tr>
<tr>
<td>Added missing "cy_cb_" to the callback function type names. </td><td></td></tr>
<tr>
<td>Replaced variables that have limited range of values with enumerated types. </td><td></td></tr>
<tr>
<td>Added function <a class="el" href="group__group__scb__uart__low__level__functions.html#gab26a75a58d128e402f3bba6ff2bdad82">Cy_SCB_UART_SendBreakBlocking</a> for break condition generation. </td><td></td></tr>
<tr>
<td>Fixed low power callbacks <a class="el" href="group__group__scb__uart__low__power__functions.html#gaa26ee4aa1c2ac9fb98daddbfe6e151aa">Cy_SCB_UART_DeepSleepCallback</a> and <a class="el" href="group__group__scb__uart__low__power__functions.html#gad72ab6609be39108f73aea440d229bce">Cy_SCB_UART_HibernateCallback</a> to prevent the device from entering low power mode when RX FIFO is not empty. </td><td>The callbacks allowed entering device into low power mode when RX FIFO had data.  </td></tr>
<tr>
<td>Fixed SPI callback notification when error event occurred. </td><td>The SPI callback passed incorrect event value if error event occurred.  </td></tr>
<tr>
<td>Fixed the <a class="el" href="group__group__scb__i2c__master__low__level__functions.html#ga2177b4fb74cf33e57e6fa59d04bdfa7a">Cy_SCB_I2C_MasterSendReStart</a> function to properly generate the ReStart condition when the previous transaction was a write. </td><td>The master interpreted the address byte written into the TX FIFO as a data byte and continued a write transaction. The ReStart condition was generated after the master completed transferring the data byte. The SCL line was stretched by the master waiting for the address byte to be written into the TX FIFO after the ReStart condition generation. The following timeout detection released the bus from the master control.  </td></tr>
<tr>
<td>Fixed the slave operation after the address byte was NACKed by the firmware. </td><td>The observed slave operation failure depends on whether Level 2 assert is enabled or not. Enabled: the device stuck in the fault handler due to the assert assignment in the <a class="el" href="group__group__scb__i2c__interrupt__functions.html#ga729b2fa4de4d44ea2e8995d7ca6a0c24">Cy_SCB_I2C_Interrupt</a>. Disabled: the slave sets the transaction completion status and notifies on the transaction completion event after the address was NACKed. The failure is observed only when the slave is configured to accept an address in the RX FIFO.  </td></tr>
<tr>
<td>1.0 </td><td>Initial version. </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__scb__common"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__scb__common.html">Common</a></td></tr>
<tr class="memdesc:group__group__scb__common"><td class="mdescLeft">&#160;</td><td class="mdescRight">Common API for the Serial Communication Block. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__scb__ezi2c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__scb__ezi2c.html">EZI2C (SCB)</a></td></tr>
<tr class="memdesc:group__group__scb__ezi2c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Driver API for EZI2C Slave Peripheral. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__scb__i2c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__scb__i2c.html">I2C (SCB)</a></td></tr>
<tr class="memdesc:group__group__scb__i2c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Driver API for I2C Bus Peripheral. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__scb__spi"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__scb__spi.html">SPI (SCB)</a></td></tr>
<tr class="memdesc:group__group__scb__spi"><td class="mdescLeft">&#160;</td><td class="mdescRight">Driver API for SPI Peripheral. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__scb__uart"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__scb__uart.html">UART (SCB)</a></td></tr>
<tr class="memdesc:group__group__scb__uart"><td class="mdescLeft">&#160;</td><td class="mdescRight">Driver API for UART. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
